<?php

namespace app\home\controller;

use app\home\model\pyg_category;
use think\facade\Db;
use think\facade\View;

class Base
{
    /**
     * @return string
     */
    public function index()
    {
        $obj = new pyg_category();
        $res = $obj->showCategory()->toArray();
        $showCategory = get_tree_list($res);
        return View::fetch('index/index',['showCategory'=>$showCategory]);
    }

    /**
     * @return string
     */
    public function javascript($id)
    {
        $obj = new pyg_category();
        $res = $obj->showCategory()->toArray();
        $showCategory = get_tree_list($res);
        $data = Db::table('pyg_goods')->select()->toArray();
        return View::fetch('goods/list',['showCategory'=>$showCategory,'data'=>$data]);
    }
}